bazel: Enable LTO only in PGO build#29514
Merged
StephanDollberg merged 1 commit intodevfrom Feb 4, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes Redpanda's build configuration by enabling Link Time Optimization (LTO) exclusively for Profile-Guided Optimization (PGO) builds, rather than for all release builds. This change improves build times for standard release builds while maintaining optimization for the primary PGO release builds.
Changes:
- Moved LTO flags from general release configuration to PGO-specific configuration
- Removed
-ffat-lto-objectsflag as it's no longer needed - Introduced new
pgo-baseconfiguration to consolidate PGO-specific LTO settings
PGO is the main release build so enable LTO only then. Saves some time in the basic release build. Also disable fat lto objects. There is no point in using them anymore as the PGO build isn't shared with anything anyway. This speeds up both the non-PGO and PGO build and also reduces object sizes.
78b1a79 to
d3c96dd
Compare
travisdowns
reviewed
Feb 4, 2026
| # bazel seems to pass -fprofile-correction unconditionally but that only exists | ||
| # in gcc so need to make clang ignore it | ||
| build:pgo-optimize --copt -Wno-ignored-optimization-argument | ||
| build:pgo-optimize --config=pgo-base --copt -Wno-ignored-optimization-argument |
Member
There was a problem hiding this comment.
details on ignored-optimization-arg?
Member
Author
There was a problem hiding this comment.
See comment above
Member
There was a problem hiding this comment.
sorry I didn't notice it wasn't added in this change
travisdowns
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PGO is the main release build so enable LTO only then. Saves some time
in the basic release build.
Also disable fat lto objects. There is no point in using them anymore as
the PGO build isn't shared with anything anyway.
This speeds up both the non-PGO and PGO build and also reduces object
sizes.
Backports Required
Release Notes